<?php

namespace app\lib\MessageBus\works;

use app\common\model\order\Order as OrderModel;
use app\lib\Instance;
use app\lib\MessageBus\base\AbstractWork;
use think\facade\Log;

class OrderCancel extends AbstractWork
{
    public function handler($message) {
//        dump("发送时间:".$message["created_at"]);
        dump("消费时间:".date("Y-m-d H:i:s"));
        $order = OrderModel::where('id',$message['order_id'])->find();
        if ($order&&$order['status']==0){
            OrderModel::where('id',$order['id'])->update(['status'=>3]);
            Log::write('order_id: '.$message['order_id'].' 任务执行成功');
        }
        dump("取消订单延迟消费终端order_id:".$message['order_id'],date("Y-m-d H:i:s"));
    }
}